//
//  JFSearchViewController.h
//  UISearchControllerDemo
//
//  Created by Alan Wang on 2018/11/5.
//  Copyright © 2018 zhoubo. All rights reserved.
//

#import <UIKit/UIKit.h>
#import <JFBase/JFBase.h>

@protocol JFSearchViewControllerSearchResultsDelegate <NSObject>
@required
-(void)updateSearchResults:(NSString*)searchText;
@optional
-(void)searchBarSearchButtonClicked;
@end


@interface JFSearchViewController : JFBaseViewController

//搜索框的背景色
@property(nonatomic,strong) UIColor * backgroundColor;

//光标的颜色
@property(nonatomic,strong) UIColor * cursorColor;
//右侧按钮的文本
@property(nonatomic,copy) NSString * rightBtnWords;
//右侧按钮的文本颜色
@property(nonatomic,strong) UIColor * rightBtnWordsColor;

//输入文字的颜色
@property(nonatomic,strong) UIColor * txtColor;
//输入框的背景色
@property(nonatomic,strong) UIColor * txtBackgroundColor;
//中间输入框的文本对其方式
@property(nonatomic)        NSTextAlignment         textAlignment;

//占位文本
@property(nonatomic,copy) NSString * placeholder;
//占位文本的字体颜色
@property(nonatomic,strong) UIColor * placeholderColor;
//是否显示灰色的层
@property(nonatomic,assign) BOOL dimsBackgroundDuringPresentation;
//是否需要进入的时候激活键盘
@property(nonatomic,assign) BOOL becomeFirstResponder;

//自定义输入键盘
@property (nonatomic, strong) UIView *inputView;
@property (nonatomic, strong) UIView *inputAccessoryView;

//当前搜索的状态
@property(nonatomic,assign,readonly) BOOL active;

//填充搜索文本
@property(nonatomic,copy) NSString * searchText;
//搜索持有的导航控制器 可能为空
@property(nonatomic,strong,readonly) UINavigationController * nav;

//展示样式的代理
@property(nonatomic,strong) id<UITableViewDelegate,UITableViewDataSource,JFSearchViewControllerSearchResultsDelegate> delegate;

-(instancetype)initWithDataSoure:(id<UITableViewDelegate,UITableViewDataSource,JFSearchViewControllerSearchResultsDelegate>) delegate;
-(void)showKeyboard;
//用于搜索时异步获取结果时使用
-(void)reloadData;

@end
